package com.xuecheng.manage_cms.web.controller;

import com.xuecheng.api.cms.CmsConfigControllerApi;
import com.xuecheng.framework.domain.cms.CmsConfig;
import com.xuecheng.manage_cms.service.CmsConfigService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author Andrew Yang
 * @ClassName CmsConfigController
 * @Description cms配置管理接口
 * @Package com.xuecheng.manage_cms.web.controller
 * @create 2020-01-15 12:13
 */
@Api(value = "cms配置管理接口", tags = "cms配置管理接口，提供数据模型的管理、查询接口")
@RestController
@RequestMapping("/config")
public class CmsConfigController implements CmsConfigControllerApi {
    @Autowired
    CmsConfigService cmsConfigService;

    @Override
    @ApiOperation("根据id查询CMS配置信息")
    @GetMapping("/getModel/{id}")
    @ApiImplicitParams(
            @ApiImplicitParam(
                    name = "id",
                    value = "id",
                    required = true,
                    paramType = "path",
                    dataType = "String"
            )
    )
    public CmsConfig getModel(@PathVariable("id") String id) {
        return cmsConfigService.getConfigById(id);
    }
}
